//-------------------------------------------------------------------
//	Copyright (c) 2010-2012 Zhirnov Andrey
//	This file is part of the "UXGEN" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------
/*
	use libarchive from http://code.google.com/p/libarchive/
*/

#ifndef _UX_LIB_ARCHIVE_FILE_SYSTEM_H
#define _UX_LIB_ARCHIVE_FILE_SYSTEM_H

#include "IVirtualFileSys.h"
#include "libarchive/lib_archive.h"

#ifndef UX_LIBARCHIVE_DISABLE

namespace Engine
{
namespace FileSystem
{

	//
	// Lib Archive File System
	//

	class _EXPORT_ CArchiveFileSys : public IVirtualFileSys
	{
	public:
		CArchiveFileSys();
		virtual ~CArchiveFileSys();

		// IVirtualFileSys //
		virtual bool IsSupported(const string &sArchiveName);	// arhive file name
		virtual bool IsExist(const string &sArchiveName, const string &sFileName);
		virtual bool OpenFile(const string &sArchiveName, const string &sFileName, IFilePtr &pFile, e_file_open_flags::type eFlags);
		virtual bool OpenCryptFile(const string &sArchiveName, const string &sFileName, const char *pPassword, IFilePtr &pFile, e_file_open_flags::type eFlags);

		virtual e_file::type GetType()	const	{ return e_file::ARCHIVE; }

		// CEngBaseObject //
		virtual void Release();
	};

//-------------------------------------------------------------------

}	// FileSystem
}	// Engine

#endif	// UX_LIBARCHIVE_DISABLE
#endif	// _UX_LIB_ARCHIVE_FILE_SYSTEM_H